package controllers.weixin;

import auth.WxMpAuth;
import models.enums.IssueStatus;
import models.global.Image;
import models.issue.Issue;
import models.user.User;
import play.mvc.Controller;
import play.mvc.With;

import java.util.List;

@With(WxMpAuth.class)
public class WorkOrderController extends Controller {

    public static void index() {
        User user = WxMpAuth.currentUser();
        List<Issue> issueList = Issue.findByWeixinUserAndStatus(user, IssueStatus.HANDLING);
        render(issueList);
    }

    public static void detail(String id) {
        Issue issue = Issue.findByIdAndUnDeleted(id);
        List<Image> images = Image.findByRecordId(issue.getId());
        render(issue, images);
    }

}
